//物业使用的api
import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
import { Result } from "@/api/community";
import { hr } from "element-plus/es/locale";

/** 获取当前物业可以管理的小区列表 */
export const getResidentialList = () => {
  return http.request<Result>(
    "get",
    baseUrlApi("property/common/residentialList")
  );
};
/** 获取商铺 */
export const getShopsList = (data?: any) => {
  return http.request<Result>(
    "get",
    baseUrlApi("property/shops/list?name=" + data)
  );
};
/** 收回出租权限 */
export const recoverShopsById = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/shops/recover?shopsId=" + data));
};

export const addShops = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/shops/edit"), { data });
};
/** 获取车位 */
export const getParkingList = (data?: any) => {
  return http.request<Result>(
    "get",
    baseUrlApi("property/parking/list?name=" + data)
  );
};
/** 收回车位出租权限 */
export const recoverParkingById = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/parking/recover?parkingId=" + data));
};
/** 添加车位 */
export const addParking = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/parking/edit"), { data });
};
/** 获取所有楼 */
export const getHouseList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/house/houseList/" + data));
};
/** 获取所有单元 */
export const getUnitList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/house/unitNumberList/" + data));
};
export const getRoomList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/house/roomNumberList/" + data));
};
/** 交房or添加房屋 */
export const addHouse = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/house/edit"), { data });
};
/** 根据小区获取所有房屋 */
export const getHouseAllByResidential = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/house/getHouseAllByResidential/" + data));
};
/** 根据小区和楼获取所有房屋 */
export const getHouseAllByHouse = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/house/getHouseAllByHouse/" + data));
};
/** 根据小区获取投诉信息 */
export const getComplainList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("common/complain/list?name=" + data.name + "&residentialId=" + data.residentialId));
};
/** 根据投诉Id获取投诉信息*/
export const getComplain = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("common/complain/info/" + data));
};
/** 处理投诉 */
export const replyComplain = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("common/complain/edit"), { data });
};
/** 根据小区获取所有公共照明 */
export const getLightList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/commonLight/list/" + data));
};
/** 添加灯具 */
export const addLight = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/commonLight/edit"), { data });
};
/** 替换灯具 */
export const replaceLightById = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/commonLight/replace/" + data));
};
/** 获取公告列表 */
export const getNoticeList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("common/notice/list?residentialId=" + data));
};
/** 发布公告 */
export const addNoticeApi = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("common/notice/edit"), { data });
};
/** 获取报修列表 */
export const getRepairList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/repair/list?name=" + data.name + "&residentialId=" + data.residentialId));
};
/** 处理报修 */
export const handleRepair = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/repair/edit"), { data });
};
/** 获取计量表列表 */
export const getMeterList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/meter/residentialList?residentialId=" + data.residentialId + "&meterType=" + data.meterType));
};
/** 上传文件 */
export const uploadFile = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/meterItem/uploadFile"), { data });
};
/** 账单结算 */
export const meterCalc = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/meterItem/calc?id=" + data));
};
/** 获取当前物业员工的收费记录 */
export const getOrderList = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/common/getOrderList?name=" + data));
};
/** 添加收费 */
export const addOrder = (data?: any) => {
  return http.request<Result>("post", baseUrlApi("property/common/addOrder"), { data });
};
export const DeleteOrder = (data?: any) => {
  return http.request<Result>("get", baseUrlApi("property/common/deleteOrder/" + data));
};
